# from  路径
# import 模块名

# *  导入当前路径下 所有的模块

# from week4.test import *
# 两种方式
# with

#  sys  os
import sys

"""
This module provides access to some variables used or maintained by the interpreter and to functions 
that interact strongly with the interpreter. It is always available.
该模块提供了对解释器使用或维护的一些变量的访问，以及与解释器进行强烈交互的函数。它总是可用的。
"""
# print(dir(sys))
# print(sys.version)
# print(sys.getdefaultencoding())  # 在python3.X 中,这个是 utf-8  ,在python2.x中是ascii
# print(sys.path)  # 模块搜索路径
# print(sys.platform)

import os

# Miscellaneous operating system interfaces
"""
This module provides a portable way of using operating system dependent functionality.
该模块提供了一种使用操作系统相关功能的可移植方式
"""
path = 'abcd.txt'
path1 = r'C:\Users\Administrator\Desktop'
path2 = r'C:\Users\Administrator\Desktop\abcd.py'

# 判断 文件或者路径是否存在
print(os.path.exists(path1))

# 判断路径路径是否是文件
print(os.path.isfile(path1))
# 判断路径是否是目录
print(os.path.isdir(path1))

print(os.path.split(path2))

# 得到一个文件的绝对路径
print(os.path.abspath(path))

path3 = 'D:\python_zero\week4\day02\daa\hah1.txt'
# 一次性创建多层文件目录
# os.makedirs(path3)
# with open(path3,'w+') as f:
#     pass

path4 = 'D:\python_zero\week4\day02\daa\hah.txt'
path5 = r'aaa\bbb\ccc\ddd'
path6 = r'aaa'
# if os.path.exists(path4):
#     os.rmdir(path4)
# else:
#     os.mkdir(path4)
#     os.makedirs(path4)
#     print('......')

# os.mkdir(path6)
# os.makedirs(path5)
# os.rmdir(path5)
sys.exit()
print('sssssssssssssssssssssss')
os.removedirs(path5)
